package com.hgw.Demo04_CreateInterator.examples;

import java.util.ArrayList;
import java.util.List;

/**
 * Data time:2021/12/18 09:31
 * StudentID:2019112118
 * Author:hgw
 * Description: 抽象聚合类
 */
public abstract class AbstractObjectList {
    protected List<Object> objects = new ArrayList<Object>();

    public AbstractObjectList(List<Object> objects) {
        this.objects = objects;
    }

    public void addObject(Object obj) {
        this.objects.add(obj);
    }

    public void removeObject(Object obj) {
        this.objects.remove(obj);
    }

    public List<Object> getObjects() {
        return objects;
    }

    // 声明创建迭代器对象的抽象工厂方法
    public abstract ProductIterator createIterator();
}
